def index_error():
    try:
        lst = [1, 3, 6]
        rst = lst[7]
    except IndexError as e:
        print(e)


def key_error():
    ages = {
        "张三": 30,
        "李四": 12
    }
    try:
        print(ages["李四"])
    except KeyError as e:
        pass


def value_error():
    num_str = "123abc"
    num = int(num_str)
    print(num)


class Person:

    def __init__(self):
        self.name = "zhangsan"
        self.age = 12


def attr_error():
    person = Person()
    print(person.name)
    print(person.score)


if __name__ == '__main__':
    # index_error()
    # key_error()
    value_error()
    # attr_error()
